﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using UmbracoExtending.Dealer.Model.Dealer;

namespace UmbracoExtending.Dealer.Controller
{
    /// <summary>
    /// 前端经销商控制器
    /// </summary>
    [PluginController("UmbracoDealer")]
    public class FrontendDealerController : UmbracoApiController
    {
        /// <summary>
        /// 获取经销商
        /// </summary>
        /// <param name="code"></param>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        [HttpGet]
        public DealerList GetDealers(string code, int page, int size)
        {
            if (page <= 0) { page = 1; }
            if (size <= 0) { size = 20; }

            return DealerUtil.GetDealers(code, page, size);
        }
    }
}
